package com.example.ah_geen_pda.model

import com.example.ah_geen_pda.base.BaseRepository
import com.example.ah_geen_pda.base.Constant
import com.example.ah_geen_pda.entity.LoginEntity
import com.example.ah_geen_pda.entity.LotEntity
import com.google.gson.JsonObject
import rxhttp.wrapper.param.RxHttp
import rxhttp.wrapper.param.toResponse


class LotInfoRepository : BaseRepository() {

    suspend fun getLotInfo(map: JsonObject): LotEntity {
        return RxHttp.postForm(Constant.REQUEST_URL_DEBUG)
            .addAll(getInJsonData(map,"GN.LOTQUERY"))
            .toResponse<LotEntity>()
            .await()
    }

    /**
     * 进站
     */
    suspend fun defaultTrackIn(map: JsonObject): Any {
        return RxHttp.postForm(Constant.REQUEST_URL_DEBUG)
            .addAll(getInJsonData(map,"GN.LOTTRACKIN"))
            .toResponse<Any>()
            .await()
    }

    /**
     * 出站
     */
    suspend fun defaultTrackOut(map: JsonObject): Any {
        return RxHttp.postForm(Constant.REQUEST_URL_DEBUG)
            .addAll(getInJsonData(map,"GN.LOTTRACKOUT"))
            .toResponse<Any>()
            .await()
    }

}